<!--#index.html-->
<!--head-->
<title xmlns="http://www.w3.org/1999/html">编辑文章</title>
<!--head end-->
<!--body-->
<script>
    var htimeout;
    $(function() {
        $("#form").ajaxForm({
            success : function(data) {
                if(data.msg) {
                    $(".alert span").text(data.msg);
                    $(".alert").removeClass("alert-success").addClass("alert-error");
                    $(".alert").fadeOut("fast").fadeIn("fast")
                } else {
                    var url = "/article/" + data.id;
                    $(".alert span").html("保存成功，3秒钟后自动<a href='" + url + "' onclick='clearTimeout(htimeout)'>跳转</a>");
                    $(".alert").removeClass("alert-error").addClass("alert-success");
                    $(".alert").fadeOut(0).fadeIn("fast");
                    htimeout = setTimeout("window.location.href = '" + url + "'", 3000);
                }
            }
        })
        $(".alert button").click(function() {
            $(".alert").hide("fast")
        })
    })
</script>
<form action="article.update" method="post" id="form" class="form-horizontal">
    <input type="hidden" name="article.id" value="${article.id}"/>
    <legend>编辑文章</legend>
    <div class="alert alert-error">
        <button type="button" class="close">×</button>
        <span></span>
    </div>
    <div class="control-group">
        <label class="control-label" for="id">标题</label>
        <div class="controls">
            <input type="text" id="id" name="article.title" class="input-xxlarge" value="${article.title}"/>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label" for="content">正文</label>
        <div class="controls">
            <textarea rows="12" id="content" name="article.content" class="input-xxlarge">${article.content}</textarea>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label" for="tags">标签</label>
        <div class="controls">
            <input type="text" id="tags" name="article.tags" class="input-xxlarge" value="${article.tags}"/>
        </div>
    </div>
    <div class="control-group">
        <div class="controls">
            <button type="submit" class="btn btn-primary">${article.id==0?'发表':'修改'}</button>
            <a href="/" class="btn">返回</a>
        </div>
    </div>
</form>
<!--body end-->
<!--#index.html end-->